package fileloaders.filters;

import java.util.HashSet;

import fileloaders.fieldpositions.YahooQueryPairsFields;

public class YahooQueryPairFilter  implements TextLineFilter, YahooQueryPairsFields{
	
	HashSet<String> valid_ages=null;
	boolean onlyClicks= false;
	int clickDuration= 0;
	boolean onlyManual=false;
	
	public YahooQueryPairFilter(HashSet<String> valid_ages, boolean onlyClicks, int clickDuration, boolean onlyManual ){
	
		this.valid_ages=valid_ages;
		this.onlyClicks=onlyClicks;
		this.clickDuration=clickDuration;
		this.onlyManual=onlyManual;
		
	}

	
	
	/**
	 * 
	 * TODO
	 * This filter is currently not doing anything
	 * 
	 * 
	 */
	@Override
	public boolean filterLine(String[] t) {
		// TODO Auto-generated method stub
	
		 String age = t[this._eval_bucket];
	 
	 	//	 String query = t[this._eval_query];
	    //	 String refor = t[this._eval_query_reformulation];
		
		 String hasClick = t[this._eval_flagClick];
		 
		 int duration = Integer.valueOf(t[this._eval_time]);
		 
		 if (duration<clickDuration)
			 return false;
		 
		 if(onlyClicks && !hasClick.toLowerCase().equals("true"))
			 return false;
		 
		 if(!valid_ages.contains(age))
			 return false;

		return false;
	}
}
